//
//  ViewController.m
//  IOS2-compute
//
//  Created by RIOS on 2018/3/26.
//  Copyright © 2018年 RIOS. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()
@property (weak, nonatomic) IBOutlet UITextField *text1;
@property (weak, nonatomic) IBOutlet UITextField *text2;
@property (weak, nonatomic) IBOutlet UILabel *result;

- (IBAction)compute:(UIButton *)sender;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}




- (IBAction)compute:(UIButton *)sender {
    NSLog(@"计算了");
    
    int n1 = self.text1.text.intValue;
    int n2 =  self.text2.text.intValue;
    
    [self.result setText:[NSString stringWithFormat:@"%d",n1+n2]];
    [self.view endEditing:YES];
    
}
@end
